home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
ftp.cs.arizona.edu
/
ftp.cs.arizona.edu.tar
/
ftp.cs.arizona.edu
/
icon
/
newsgrp
/
group96a.txt
/
000117_icon-group-sender _Tue May 7 06:59:08 1996.msg
< prev
next >
Wrap
Internet Message Format
|
1996-09-05
|
1KB
Received: by cheltenham.cs.arizona.edu; Tue, 7 May 1996 12:21:39 MST
Date: Tue, 7 May 1996 06:59:08 -0700
From: Ralph Griswold <ralph>
Message-Id: <9605071359.AA23150@ursus.cs.arizona.edu>
To: H.Lawson@tees.ac.uk, icon-group@cs.arizona.edu
Subject: Re: Why are 'every', 'until', and 'while' designed to fail?
Errors-To: icon-group-errors@cs.arizona.edu
Status: O
The reason looping control structures fail is because they produce no
value, which is equivalent to failure in Icon.
The reason there is no value is that there is no consistent way to
produce one. E.g., "do" clauses are optional.
While there are possible ways to provide an interpretation of a
returned *result*, since looping control structures usually are not
used in situations where their results are useful, we decided to
give a simple, uniform result (failure).
Using looping control structures in ways that their results could
be used generally is not good programming style -- if nothing else,
it's hard to understand.
Note that you can produce a result other than failure for a control
structure using break, as in
while ... do {
...
break s
}
which produces s for the while-do control structure if the break
expression is evaluated.
Ralph E. Griswold ralph@cs.arizona.edu
Department of Computer Science
The University of Arizona 520-621-6609 (voice)
P.O. Box 210077
Tucson, AZ 85721-0077 520-621-4246 (fax)